
<?php
$aksi="module/mahasiswa/aksi.php";
switch($_GET[act]){
  // Tampil Berita
  default:
?>
<h2>Input Kelulusan Mahasiswa Skripsi</h2>

<table width="641" >
  <tr >
    <th width="20">No</th>
    <th width="103">npk</th>
    <th width="172">Nama</th>
    <th width="155">Dosen</th>
    <th width="167">Aksi</th>
  </tr>
 <?php 
 
 	$p      = new Paging;
    $batas  = 5;
    $posisi = $p->cariPosisi($batas);
 
 		$sql="SELECT
				mahasiswa.nama,
				proposal_skripsi.npk,
				proposal_skripsi.id_proposal,
				proposal_skripsi.status,
				proposal_skripsi.nip,
				dosen.nama AS dosen
				FROM
				mahasiswa
				Inner Join proposal_skripsi ON proposal_skripsi.npk = mahasiswa.npk
				Inner Join dosen ON proposal_skripsi.nip = dosen.nip  ORDER BY proposal_skripsi.id_proposal DESC LIMIT $posisi,$batas";
 		$query=@mysql_query($sql);
	$no=1 + $posisi;
		while ($data=@mysql_fetch_array($query)){
  ?>
   <tr class="<?php if ($no %2 == 0):echo "zebra";else:echo "zebra2"; endif;?>" align="center">
    <td><?php echo $no; ?></td>
    <td><?php echo $data['npk']; ?></td>
    <td><?php echo $data['nama']; ?></td>
    <td><?php echo $data['dosen']; ?></td>
     <td align="center">
     <? if ($data['status']==2){
     echo '<a href=?mod=skripsi&act=editnilai&id='.$data[id_proposal].'>Edit Data </a>';
	 }
	 else {
	 echo '<a href=?mod=skripsi&act=inputnilai&id='.$data[id_proposal].'>Input Data </a>';
	 } 
	 ?>
	 | 
     <?php echo "<a href=$aksi?mod=skripsi&act=hapus&id=$data[id_proposal]>"; ?>Hapus</a> </td>
  </tr>
  
 <?php 
 $no++;
 } ?>
</table>
<center><?php 
    $jmldata = mysql_num_rows(mysql_query("SELECT * FROM slide"));
    $jmlhalaman  = $p->jumlahHalaman($jmldata, $batas);
    $linkHalaman = $p->navHalaman($_GET[halaman], $jmlhalaman);

    echo "<div id=paging>$linkHalaman</div><br>";
break;
  case "inputnilai":
  ?>
  <h2>Input  Kelulusan Mahasiswa Skripsi</h2>
<?php echo "
  <form method=POST action='$aksi?mod=skripsi&act=input' enctype='multipart/form-data'>"; 
   $id=$_GET['id'];

			$sql="SELECT
					proposal_skripsi.nip,
					dosen.nama AS dosen,
					mahasiswa.nama,
					proposal_skripsi.npk,
					proposal_skripsi.id_proposal,
					proposal_skripsi.no_stdps
					FROM
					proposal_skripsi
					Inner Join dosen ON dosen.nip = proposal_skripsi.nip
					Inner Join mahasiswa ON proposal_skripsi.npk = mahasiswa.npk
					where proposal_skripsi.id_proposal='$_GET[id]'";  
 $query=@mysql_query($sql);
 $r=@mysql_fetch_array($query); 

  ?>
<table width="591" >
  <tr>
    <td width="144">NO</td>
    <?php $no=substr($r['no_stdps'],0,4);?>
    <td width="435"><input type="text" name='jns_no2' value="1" readonly="readonly" size="4" />
        <input type="hidden" name='id' value="<? echo $r['id_proposal'];?>" />
         <input type="text" name='no' value="<?=$no;?>" readonly="readonly" size="4" />
        <input type="text" name='jurusan' value="PK I S-1 Akt"  readonly="readonly" size="10" />
        <input type="text" name='kampus' value=" STEI " readonly="readonly" size="4" />
      </select>
        <select name="no_bulan" style="width:70px">
          <option value="I">Jan</option>
          <option value="II">Feb</option>
          <option value="III">Mar</option>
          <option value="IV">Apr</option>
          <option value="V">Mei</option>
          <option value="VI">Jun</option>
          <option value="VII">Jul</option>
          <option value="VIII">Ags</option>
          <option value="IX">Sep</option>
          <option value="X">Okt</option>
          <option value="XI">Nov</option>
          <option value="XII">Des</option>
        </select>
      <select name="no_tahun" style="width:72px">
          <?PHP
			$tahun = 2000; 
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
      </select></td>
  </tr>
  <tr>
    <td width="144">NIP Dosen</td>
    <td width="435"><input type="text" value="<?php echo $r[dosen]; ?>" readonly="readonly" size="15" />
    <input type="hidden" name='nip' value="<?php echo $r[nip]; ?>"/></td>
  </tr>
  <tr>
    <td width="144">NPK Mahasiswa</td>
    <td width="435"><input type="hidden" name='no_klss2' value="<?php echo $r[no_klss]; ?>" />
        <input type="text" name='npk' value="<?php echo $r[npk]; ?>" size="15" readonly="readonly" />    </td>
  </tr>
  <tr>
    <td width="144">Nip Dosen Pengguji</td>
    <td width="435"><select name="nip2" style="width:150px">
      <?PHP
			$sql="select * from dosen";
			$query=@mysql_query($sql);
			
			while ($j=@mysql_fetch_array($query)){
			echo "<option value=$j[nama] >$j[nama]</option>";
			
			}
			?>
    </select>
        <br />
        <select name="nip3" style="width:150px">
          <?PHP
			$sql="select * from dosen";
			$query=@mysql_query($sql);
			
			while ($j=@mysql_fetch_array($query)){
			echo "<option value=$j[nama] >$j[nama]</option>";
			
			}
			?>
        </select>
        <br /></td>
  </tr>
  <tr>
    <td width="144">Nilai IPK</td>
    <td width="435"><input type="text" name='nilai' value="<?php echo $r[ipk_terahir]; ?>" size="15" />    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" value="Simpan" />
        <input type="button" value="Batal" onclick="self.history.back()" /></td>
  </tr>
</table>
</form>
  
<?php break; 
 case "editnilai":
 ?>
<h2>Edit  Kelulusan Mahasiswa Skripsi</h2>
 <?php echo "
  <form method=POST action='$aksi?mod=skripsi&act=update' enctype='multipart/form-data'>"; 
 $id=$_GET['id'];

			$sql="SELECT
					kelulusan_skripsi.id_proposal,
					kelulusan_skripsi.id_nilai,
					kelulusan_skripsi.nip,
					kelulusan_skripsi.no_stdps,
					dosen.nama AS dosen,
					nilai.id_nilai,
					nilai.npk,
					nilai.ipk_terahir,
					tb_penguji.nip1,
					tb_penguji.nip2
					FROM
					kelulusan_skripsi
					Inner Join dosen ON kelulusan_skripsi.nip = dosen.nip
					Inner Join nilai ON kelulusan_skripsi.id_nilai = nilai.id_nilai
					Inner Join tb_penguji ON nilai.npk = tb_penguji.npk
					WHERE
					kelulusan_skripsi.id_proposal = '$_GET[id]'";  
 $query=@mysql_query($sql);
 $r=@mysql_fetch_array($query); 
  ?>
 <table width="591" >
    <tr>
      <td width="144">NO</td>
     <?php $no=substr($r['no_stdps'],3,4);?>
     
      <td width="435"><input type=text name='jns_no' value="1" readonly="readonly" size=4>
      <input type=hidden name='id_nilai' value="<?=$r[id_nilai];?>">
      <input type=text name='no' value="<?=$no;?>" readonly="readonly" size=4>
      				  <input type=text name='jurusan' value="PK I S-1 Akt"  readonly="readonly" size=10>
       				  <input type=text name='kampus' value=" STEI " readonly="readonly" size=4></select>
			<select name="no_bulan" style="width:70px">
			<option value="I">Jan</option>
			<option value="II">Feb</option>
			<option value="III">Mar</option>
			<option value="IV">Apr</option>
			<option value="V">Mei</option>
			<option value="VI">Jun</option>
			<option value="VII">Jul</option>
			<option value="VIII">Ags</option>
			<option value="IX">Sep</option>
			<option value="X">Okt</option>
			<option value="XI">Nov</option>
			<option value="XII">Des</option>
			</select><select name="no_tahun" style="width:72px">
			<?PHP
			$tahun = 2000; 
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select></td>
    </tr>
    <tr>
      <td width="144">NIP Dosen</td>
    
      <td width="435"><input type=text name='npk' value="<?php echo $r[dosen]; ?>" readonly="readonly" size=15>
			</td>
    </tr>
     <tr>
      <td width="144">NPK Mahasiswa</td>
    
      <td width="435"><input type=hidden name='no_klss' value="<?php echo $r[no_klss]; ?>" >
    
      <input type=text name='npk' value="<?php echo $r[npk]; ?>" size=15 readonly="readonly"> </td>
    </tr>
    <tr>
      <td width="144">Nip Dosen Pengguji</td>
    
      <td width="435"><select name="nip1" style="width:150px">
        <?PHP
			$sql="select * from dosen";
			$query=@mysql_query($sql);
			
			while ($j=@mysql_fetch_array($query)){
			echo "<option value=$j[nama] >$j[nama]</option>";
			
			}
			?>
      </select>
        <br />
        <select name="nip2" style="width:150px">
          <?PHP
			$sql="select * from dosen";
			$query=@mysql_query($sql);
			
			while ($j=@mysql_fetch_array($query)){
			echo "<option value=$j[nama] >$j[nama]</option>";
			
			}
			?>
        </select>
      <br /></td>
    </tr>
    <tr>
      <td width="144">Nilai IPK</td>
    
      <td width="435"><input type=text name='nilai' value="<?php echo $r[ipk_terahir]; ?>" size=15> </td>
    </tr>
   
    <tr>
      <td>&nbsp;</td>
      <td><input type=submit value=Simpan>
                            <input type=button value=Batal onclick=self.history.back()></td>
    </tr>
  </table>
</form>
 <?php break; ?>
<?php } ?>